﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;
using Sword.Data;

namespace Sword.Utility
{
    public static class XmlUtility
    {
        public static AppConfigRootEntity LoadConfigs(String file)
        {
            AppConfigRootEntity appConfig = new AppConfigRootEntity();
            appConfig.GroupInputRules = new List<string>();
            using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader sr = new StreamReader(fs))
                {
                    while (true)
                    {
                        string line = sr.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        if (!String.IsNullOrEmpty(line))
                        {
                            appConfig.GroupInputRules.Add(line);
                        }
                    }
                }
            }
            return appConfig;
        }
    }
}
